<?php

class omekpi_mdl_servicer_log extends dbeav_model{
    
    function getCount($where=''){
        $count = $this->db->select('select sum(received_orders) as count_orders, sum(payed_orders) as count_paded_orders,sum(my_sales) as count_sales from sdb_omekpi_servicer_log '.$where);
        foreach($count as $key=>$value){
            return $value;
        }
    }

    function getPageData($where=''){
        return $this->db->select('SELECT sdb_omekpi_servicer_log.* , sdb_omekpi_employee.* ' .
                'FROM `sdb_omekpi_servicer_log` INNER JOIN sdb_omekpi_employee ' .
                'ON sdb_omekpi_servicer_log.employee_id = sdb_omekpi_employee.employee_id and sdb_omekpi_employee.employee_type='."'".'servicer'."' ".$where);
    }
    
    function search($where){
        return $this->db->select("SELECT * FROM sdb_omekpi_servicer_log ".$where);
    }

    function update($addarray){
        return $this->db->exec("update sdb_omekpi_servicer_log set " .
                "received_orders='".$addarray['received_orders']."',payed_orders='".$addarray['payed_orders']."',my_sales='".$addarray['my_sales']."'" .
                "where employee_id='".$addarray['employee_id']."' and createdate='".$addarray['createdate']."'"); 
    }
}
?>
